﻿using DocumentFormat.OpenXml.Lite.DrawingML.Chart.Elements;
using DocumentFormat.OpenXml.Lite.DrawingML.Types;
using DocumentFormat.OpenXml.Lite.Shared;
using DocumentFormat.OpenXml.Lite.Xml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace DocumentFormat.OpenXml.Lite.DrawingML.Chart
{
    [XmlRoot("barChart", Namespace = Constants.Chart)]
    public class BarChart : XmlSerializable, IChartElement
    {
        [XmlElement("bardir", Namespace = Constants.Chart)]
        public NullableValue<ST_BarDir> Direction { get; set; }

        [Optional]
        [XmlElement("grouping", Namespace = Constants.Chart)]
        public NullableValue<ST_BarGrouping> Grouping { get; set; }

        [Optional]
        [XmlElement("varyColors", Namespace = Constants.Chart)]
        public NullableValue<bool> VaryColors { get; set; }

        [Optional]
        [XmlElement("ser", Namespace = Constants.Chart)]
        public XmlList<BarSeries> Series { get; set; }

        [Optional]
        [XmlElement("dLbls", Namespace = Constants.Chart)]
        public DataLabels DataLabels { get; set; }

        [Optional]
        [XmlElement("gapWidth", Namespace = Constants.Chart)]
        public NullableValue<uint> GapWidth { get; set; }

        [Optional]
        [XmlElement("serLines", Namespace = Constants.Chart)]
        public XmlList<SeriesLine> SeriesLines { get; set; }

        [Optional]
        [XmlElement("overlap", Namespace = Constants.Chart)]
        public NullableValue<byte> Overlap { get; set; }

        [XmlElement("axId", Namespace = Constants.Chart)]
        public RequiredValue<uint> Axis1Id { get; set; }

        [XmlElement("axId", Namespace = Constants.Chart)]
        public RequiredValue<uint> Axis2Id { get; set; }

        [Optional]
        [XmlElement("extLst", Namespace = Constants.Chart)]
        public ExtensionList ExtensionList { get; set; }

        public BarChart() 
        {
            Series = new XmlList<BarSeries>();
        }
    }
}
